import Vue from "vue";
import VueRouter from "vue-router";
import guide from "../views/Guide.vue";

Vue.use(VueRouter);

const routes = [
  // 引导页
  {
    path: "/",
    name: "guide",
    component: guide,
    meta: {
      icon: "icon-guide",
    },
    hidden: true,
  },
  // 个人博客
  {
    path: "/blog",
    name: "blog",
    component: () => import("../layout/layout.vue"),
    meta: {
      title: "个人博客",
    },
    children: [
      {
        path: "/home",
        name: "home",
        meta: {
          title: "Home",
          icon: "icon-home",
        },
        component: () => import("../views/Home.vue"),
      },
      {
        path: "/article",
        name: "article",
        meta: {
          title: "Article",
          icon: "icon-article",
        },
        component: () => import("../views/Article.vue"),
      },
      {
        path: "/articleDetail",
        name: "articleDetail",
        hidden: true,
        meta: {
          title: "Article-Detail",
          icon: "icon-article",
        },
        component: () => import("../views/Detail.vue"),
      },
      {
        path: "/about",
        name: "about",
        meta: {
          title: "About",
          icon: "icon-about",
        },
        component: () => import("../views/About.vue"),
      },
      {
        path: "/404",
        name: "notFound",
        component: () => import("../views/404.vue"),
        hidden: true,
      },
    ],
  },

  {
    path: "*", // 此处需特别注意置于最底部
    redirect: "/404",
    hidden: true,
  },
];

const router = new VueRouter({
  routes,
});

export default router;
